package com.cloudfun.campusshare.schedule;

import com.cloudfun.campusshare.service.PromotionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by Huqin on 2020/6/9
 */
@Slf4j
@Component
public class PromotionStatusChangeSchedule extends BaseScheduleTask {

    @Autowired
    private PromotionService promotionService;

    /**
     * 每分钟执行一次
     */
    @Scheduled(fixedRate = 60 * 1000)
    public void changeBidStatus() {
        this.execute();
    }

    @Override
    protected String getTaskName() {
        return "活动上线";
    }

    @Override
    protected void doExecute() {
        promotionService.autoChangeStatus();
    }
}
